<?php

namespace App\Models\Plane\PlaneOrderPassengers\Repositories\Interfaces;

use App\Models\Plane\PlaneOrderPassengers\PlaneOrderPassenger;
use App\Models\Plane\PlaneOrders\PlaneOrder;
use App\Models\Trip\TripOrderRefund\TripOrderRefund;
use App\Trip\Train\Order\Interfaces\OrderPassengerRefundInterface;

interface PlaneOrderPassengerRepositoryInterface
{
    public function addPassengers(PlaneOrder $order, $passengers_data);

    public function addOnePassenger(PlaneOrder $order, $data): PlaneOrderPassenger;

    public function findOneOrderPassenger(string $order_sn, string $passenger_id, int $sequence): PlaneOrderPassenger;

    public function updatePassenger(PlaneOrderPassenger $passenger, array $data);


    /**
     * 发起退款
     *
     * @param OrderPassengerRefundInterface $order_passenger_refund
     *
     * @return TripOrderRefund
     */
    public function refund(OrderPassengerRefundInterface $order_passenger_refund): TripOrderRefund;


    public function ticketReturnSuccess(PlaneOrder $order, $passengers, TripOrderRefund $refund_info);

    public function ticketReturnFailed(PlaneOrder $order, $passengers, TripOrderRefund $refund_info, string $failed_reason);

    public function getOrderInfoBySubOutOrderId(string $sub_out_order_id): ?PlaneOrder;

    public function getChangingNewOrderInfoBySubOutOrderId(string $sub_out_order_id): ?PlaneOrder;

    public function findOneByIdentityCode(string $order_sn, string $identity_code): PlaneOrderPassenger;

    /**
     * 通过姓名和票号查找乘客信息
     * @param string          $true_name
     * @param string          $ticket_number
     * @param PlaneOrder|null $order_info
     * @return PlaneOrderPassenger|null
     */
    public function findOneByNameAndTicketNumber(string $true_name, string $ticket_number, ?PlaneOrder $order_info = null): ?PlaneOrderPassenger;
}